<?php
/**
 * Created by JetBrains PhpStorm.
 * User: cgp
 * Date: 13-4-10
 * Time: 下午5:43
 */

$SceneryClass = array('AAAAA','AAAA','AAA','AA','A','非A级');

$WeekList = array('周日', '周一', '周二', '周三', '周四', '周五', '周六',);
$WeekListShort = array('日', '一', '二', '三', '四', '五', '六',);

$cusInfo = array('姓名','身份证号');
$LandStatusList = array(
    '<span class="blue">未审核</span>','在售','<span class="red">已下架</span>','<span class="red">已删除</span>'
);
$ProdcutTopic = array(
    '温泉养生', '漂流避暑', '主题乐园', '海滨海岛', '山水园林', '游船游轮',
    '名胜古迹', '古镇古迹', '文化宗教', '民俗文化', '动植物园', '博物馆', '度假山庄',
    '户外拓展', '城市观光', '影视基地', '演艺演出', '乡村游'
);

$ProdTypes = array('A'=>'景区门票','B'=>'旅游线路','C'=>'度假酒店','D'=>'旅游商品','F'=>'套票');
$ProdTypes_S = array('A'=>'景区','B'=>'线路','C'=>'酒店','D'=>'商品','F'=>'套票');
$ProdColor = array('A'=>'blue','B'=>'maroon','C'=>'orange','D'=>'teal');
$ProvideTo = array(
    0=>'所有渠道',
    2=>'仅官网零售',
    3=>'仅同业分销',
    4=>'仅自营销售',
    5=>'仅用于产品打包',
);
$ProdState = array(
    0=>'未审核',
    1=>'正常',
    2=>'下架',
    3=>'已拒绝',
    4=>'已删除'
);
$P2L = array(0=>'不限',1=>'下架',2=>'仅零售',3=>'仅分销',
    4=>'仅直属下级',5=>'仅所有者',6=>'删除', 8=>'被拒绝',9=>'未审核');
$ProdStatusListTxt = array(0=>'不限',1=>'下架',2=>'仅零售',3=>'仅分销',
    4=>'仅直属下级',5=>'仅所有者',6=>'删除', 8=>'被拒绝',9=>'未审核');
$ProdStatusList = array('<span class="green">不限</span>','<span class="orangered">下架</span>','仅零售','仅分销',
    '仅直属下级','仅所有者','<span class="red">删除</span>',
    8=>'<span class="red">被拒绝</span>',9=>'<span class="blue">未审核</span>');
$LogtypeList = array('其他信息','上架','下架','涨价','降价');

//订单列表显示用
$statuTxt     = array('<span class="blue">未使用</span>',
    '<span class="gray">已使用</span>',
    '<span class="blue">已过期</span>',
    '<span class="red">已取消</span>',
    '<span class="red">被替代</span>',
    '被修改',
    '被撤销',
    7=>'部分使用'
);
$paystatusTxt = array('现场支付','<span class="green">已付款</span>','未支付',4=>'手机下单',9=>'分销采购');
$payInfoTxt   = array('','<span class="teal">(在线)</span>','<span class="maroon">(16U)</span>','');

function GetChkBox($list,$name='errcln',$chkd=array(),$attrs=array()) {
    if(!is_array($list)) {
        return;
    }
    $chk = '';
    $str_attr = '';
    if(!empty($attrs)) {
        foreach($attrs as $attr=>$val) {
            $str_attr .= "$attr='{$val}'";
        }
    }
    foreach($list as $key=>$val) {
        $chk .= "<label><input type='checkbox' name='{$name}[]'";
        if(!empty($chkd) && in_array($key,$chkd)) {
            $chk .= ' checked="checked"';
        }
        $chk .= " {$str_attr} value='{$key}'>{$val}</label>";
    }
    return $chk;
}


function GetHtmlSelectByValue($lists,$name,$selected='', $default='', $attrs=array()) {
    $output = "<select name='{$name}'";
    if(count($attrs)) {
        foreach($attrs as $attr=>$val) {
            $output .= " {$attr}='{$val}'";
        }
    }
    $output .= '>';
    if(is_array($default)) {
        $output .= "<option value='{$default['k']}'>{$default['v']}</option>";
    }
    elseif(is_bool($default) && $default==true) {
        $output .= "<option value=''>--请选择--</option>";
    }

    if(is_array($lists)){
        foreach($lists as $key=>$list) {
            $output .= "<option value='{$list}'" . ($key == $selected && is_numeric($selected) ? "selected='selected'" : '');
            $output .= ">{$list}</option>";
        }
        $output .= "</select>";
        return $output;
    }
    return false;
}

function GetRadio($chkd, $id) {
    $ptypeArr = array('通用','节假日 ');
    $outradio = '<select name="ticket['.$id.'][usedTime]">';
    foreach($ptypeArr as $key=>$val) {
        $outradio .= '<option value="'.$key.'"';
        if($chkd == $key) {
            $outradio .= ' selected="selected" ';
        }
        $outradio .= '>'.$val.'</option>';
    }
    $outradio .= '</select>';
    return $outradio;
}

function GetApplyerList(){
    $strGetApplyer = "SELECT DISTINCT apply_did FROM uu_land";
    $GLOBALS['le']->query($strGetApplyer);
    $applyers = array();
    while($rows = $GLOBALS['le']->fetch_assoc()) {
        $applyers[] = $rows['apply_did'];
    }
    $applyers_id = implode(',',$applyers);

    $str="SELECT id,dname,getPy(dname,1) as py,passport FROM uu_distributor WHERE id IN({$applyers_id}) ORDER BY py,id";
    $GLOBALS['le']->query($str);
    $applyerList = array();
    while($row=$GLOBALS['le']->fetch_assoc()){
        $applyerList[$row['id']] = $row['py'].'-'.$row['dname'].'['.$row['passport'].']';
    }
    return $applyerList;
}
function GetApplyerSelect($selected=''){
    $applyers = GetApplyerList();
    return GetHtmlSelect($applyers,'applyer',$selected,true);
}